
package com.platform.api.bzproject.controller;

import com.platform.api.bzproject.param.SendSmsParam;
import com.platform.api.bzproject.service.SmsLogService;
import com.platform.common.core.Result;
import com.platform.common.enums.SmsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Maps;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/sms")
@Api(tags = "发送验证码接口")
public class SmsController {

    @Autowired
    private SmsLogService smsLogService;

//    /**
//     * 发送验证码接口
//     */
//    @PostMapping("/send")
//    @ApiOperation(value = "发送验证码", notes = "用户的发送验证码")
//    public ResponseEntity<Void> audit(@RequestBody SendSmsParam sendSmsParam) {
//        smsLogService.sendSms(SmsType.VALID, sendSmsParam.getMobile(), Maps.newHashMap());
//        return ResponseEntity.ok().build();
//    }

    /**
     * 发送验证码接口
     */
    @PostMapping("/send")
    @ApiOperation(value = "发送验证码", notes = "用户的发送验证码")
    public Result audit(@RequestBody SendSmsParam sendSmsParam) throws Exception {

        smsLogService.sendSms(SmsType.VALID, sendSmsParam.getMobile(), Maps.newHashMap());
        return Result.success();
    }

}
